<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<link rel="stylesheet" type="text/css" href="../user/table.css" >
<link rel="stylesheet" type="text/css" href="../allpage.css" >
<script type="text/javascript">
	window.onload = function(){
		document.getElementById('subBtn').disabled=true;
	};
	function toEdit(id,name){
		document.getElementById("idField").value=id;
		document.getElementById("nameField").value=name;
		document.getElementById('subBtn').disabled=false;
	}
</script>
<body>
<font color="red">${msg }</font>
	<table>
		<tr>
			<td>专长</td>
			<td>操作</td>
		</tr>
		<c:forEach var="spec" items="${specList}">
		<tr>
			<td>${spec.name }</td>
			<td><a href="" onclick="toEdit('${spec.id}','${spec.name}');return false;" >修改</a>/<a href="../servlet/SpecServlet?type=del&id=${spec.id}">删除</a></td>
		</tr>
		</c:forEach>
		<tr></tr>
		<tr>
			<form method="post" action="../servlet/SpecServlet?type=edit">
			<input id="idField" type="hidden" name="id"/>
			<td colspan="2"><input id="nameField" name="name" type="text" />&nbsp;<input id="subBtn" type="submit" value="修改" /></td>
			</form>
		</tr>
		<tr></tr>
		<tr>
			<form method="post" action="../servlet/SpecServlet?type=add">
			<td colspan="2"><input id="nameField" name="name" type="text" />&nbsp;<input id="subBtn" type="submit" value="保存" /></td>
			</form>
		</tr>
	</table>
</body>
</html>